#
#   Messages.py
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 of the License.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   Copyright
#   Author: Nicholas F. Hoover
#   Contributors: Salvatore S. Gionfriddo
#   Created: 2007.07.01
#   Last Modified: 2007.07.13
#

import pygame
import hud

def printSubtitle(screen):
    subtitleString1 = "The game which keeps defeating the"
    subtitleString2 = "child who crowds intently."
    subtitleLabel1 = hud.label(screen, (300,450), subtitleString1)
    subtitleLabel2 = hud.label(screen, (300,500), subtitleString2)
    subtitleLabel1.setSize(25)
    subtitleLabel1.draw()
    subtitleLabel2.setSize(25)
    subtitleLabel2.draw()
    
def printLoading(screen):
    loadingString = "Loading..."
    loadingLabel = hud.label(screen,(20,575), loadingString)
    loadingLabel.draw()

def printDoneLoading(screen):
    loadingString = "Loading... DONE"
    loadingLabel = hud.label(screen,(20,575), loadingString)
    loadingLabel.draw()
    pressEnterString = "Press Enter"
    pressEnterLabel = hud.label(screen,(650,575), pressEnterString)
    pressEnterLabel.draw()
    
def printInstructions(screen):
    strings = ("Instructions:",
               "Use arrow keys to move. Additional instructions will follow each level.",
               "General control:",
               "     P: pause",
               "     F: toggle FPS display",
               "     M: toggle music",
               "     Enter: continue from instructions, un-pause",
               "     Escape: to Quit.",
               "Press Enter to return to the Main Menu.")

    instructionTextBox = hud.text_box(screen, (100,50), strings)
    instructionTextBox.position = ( (800 - instructionTextBox.rendered_rect.width)/2, 150)
    instructionTextBox.render()
    instructionTextBox.draw()
    
def printPaused(screen):
    strings = ["Game Paused. Press Enter to continue or Escape to return to the Main Menu."]
    pausedTextBox = hud.text_box(screen, (125,100), strings)
    pausedTextBox.draw()

def printGameOver(screen, score, highScore, details, win):
    if win: gameover = "You Win - Game Over"
    else: gameover = "You Lose - Game Over"
    strings = [gameover,
               "Press Enter to  to return to the Main Menu or Escape to Quit.",
               ""]
    for entry in details:
        if entry[1] != 0:
            strings.append(entry[2] + ": " + str(entry[1]) + " X " + str(entry[0]))
    strings += ["",
               'Your Score: ' + str(score),
               'High Score: ' + str(highScore)]
    gameOverTextBox = hud.text_box(screen, (100,200), strings)
    gameOverTextBox.position = ( (800 - gameOverTextBox.rendered_rect.width)/2, 150)
    gameOverTextBox.render()
    gameOverTextBox.draw()

    
def printLevel(screen, level, level_desc):
    strings = [str(level)] + level_desc
    levelTextBox = hud.text_box(screen, (100,150), strings)

    levelTextBox.position = ( (800 - levelTextBox.rendered_rect.width)/2, 150)
    levelTextBox.render()
    levelTextBox.draw()

def printQuit(screen):
    quitStrings = ["Are you sure you want to quit this game?",
               "Press Escape again to return to the Main Menu or Enter to continue playing."]
    quitTextBox = hud.text_box(screen,(0,0), quitStrings)

    quitTextBox.position = ((800 - quitTextBox.rendered_rect.width)/2, 150)
    quitTextBox.render()
    quitTextBox.draw()
    
    
